package com.offcn.dao;

import com.offcn.entity.pet_system;
import com.offcn.utlis.BaseDao;

import java.util.List;

public class Pet_SystemDaoImpl extends BaseDao<pet_system> implements Pet_SystemDao {
    /**
     * 分页
     * @param sql
     * @param peams
     * @return
     */
    @Override
    public List<pet_system> find(String sql, Object... peams) {
        return getMore(sql,pet_system.class,peams);
    }

    /**
     * 删除
     * @param pid
     * @return
     */
    @Override
    public int delfind(String pid) {
        return update("delete from pets where pid = ?",pid);
    }

    /**
     * 修改
     * @param petSystem
     * @return
     */
    @Override
    public int updateByid(pet_system petSystem) {
        return update("update pets set pname = ?,age = ? ,brand = ?,color = ? where pid = ? " ,petSystem.getPname(),
                petSystem.getAge(),petSystem.getBrand(),petSystem.getColor(),petSystem.getPid()) ;
    }

    /**
     * 添加
     * @param petSystem
     * @return
     */
    @Override
    public int add(pet_system petSystem) {
        return update("insert into pets (pname ,age ,brand ,color) values(?,?,?,?)",
                petSystem.getPname(),petSystem.getAge(),petSystem.getBrand(),petSystem.getColor());
    }


}
